forked from cwtch.im/libcwtch-go
Merge pull request 'change_password' (#53) from change_password into trunk
Reviewed-on: cwtch.im/libcwtch-go#53 Reviewed-by: erinn <erinn@openprivacy.ca>
This commit is contained in:
commit
68c02502a2
12
go.sum
12
go.sum
|
@ -11,14 +11,9 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
|
|||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cwtch.im/cwtch v0.14.1/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.2 h1:Q9rUainxUcHB2+F46lxhIS5kwZLy9BhPoQI1WnKcOD4=
|
||||
cwtch.im/cwtch v0.14.2/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.3 h1:CKNBYGfKErtLDY3fUOyadTVNbI2JjOe+Ud/srydVAko=
|
||||
cwtch.im/cwtch v0.14.3/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.4 h1:QbQVzrAqczAG5tGazQvRVfN7MyQPWVN5Fwv7MzCXZs4=
|
||||
cwtch.im/cwtch v0.14.4/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.5 h1:GY86C8UgqmuGh7ATR4C14hndc+c7PwPI8WH3l2iwnaQ=
|
||||
cwtch.im/cwtch v0.14.5/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.1/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.6 h1:biwYF3NRM+lfDaw+kLdtGrCuVc2YbyOatTUdbsQS6do=
|
||||
cwtch.im/cwtch v0.14.6/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
cwtch.im/cwtch v0.14.6/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
|
||||
|
@ -279,7 +274,6 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl
|
|||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
|
|
25
lib.go
25
lib.go
|
@ -13,6 +13,9 @@ import (
|
|||
|
||||
constants2 "cwtch.im/cwtch/model/constants"
|
||||
|
||||
"git.openprivacy.ca/cwtch.im/libcwtch-go/features"
|
||||
|
||||
|
||||
// Import SQL Cipher
|
||||
"os/user"
|
||||
"runtime"
|
||||
|
@ -882,6 +885,28 @@ func SetMessageAttribute(profileOnion string, conversationID int, channelID int,
|
|||
}
|
||||
}
|
||||
|
||||
//export c_ChangePassword
|
||||
func c_ChangePassword(profile_ptr *C.char, profile_len C.int, oldpassword_ptr *C.char, oldpassword_len C.int, newpassword_ptr *C.char, newpassword_len C.int, newpassword_again_ptr *C.char, newpassword_again_len C.int) {
|
||||
profileOnion := C.GoStringN(profile_ptr, profile_len)
|
||||
oldPassword := C.GoStringN(oldpassword_ptr, oldpassword_len)
|
||||
newPassword := C.GoStringN(newpassword_ptr, newpassword_len)
|
||||
newPasswordAgain := C.GoStringN(newpassword_again_ptr, newpassword_again_len)
|
||||
ChangePassword(profileOnion, oldPassword, newPassword, newPasswordAgain)
|
||||
}
|
||||
|
||||
// ChangePassword provides a wrapper around profile.ChangePassword
|
||||
func ChangePassword(profileOnion string, oldPassword string, newPassword string, newPasswordAgain string) {
|
||||
profile := application.GetPeer(profileOnion)
|
||||
log.Infof("changing password for %v", profileOnion)
|
||||
err := profile.ChangePassword(oldPassword, newPassword, newPasswordAgain)
|
||||
log.Infof("change password result %v", err)
|
||||
if err == nil {
|
||||
eventHandler.Push(event.NewEvent(event.AppError, map[event.Field]string{event.Data: features.ConstructResponse("changepassword", constants.StatusSuccess).Error()}))
|
||||
} else {
|
||||
eventHandler.Push(event.NewEvent(event.AppError, map[event.Field]string{event.Data: features.ConstructResponse("changepassword", err.Error()).Error()}))
|
||||
}
|
||||
}
|
||||
|
||||
//export c_ShutdownCwtch
|
||||
func c_ShutdownCwtch() {
|
||||
ShutdownCwtch()
|
||||
|
|
Loading…
Reference in New Issue