Ookma-Kyi
08/04/2022, 6:02 PMNo matching function [AUTH] found
try{
auth.authenticate( auth().user().getEmail(), rc.password );
} catch ( InvalidCredentials e ) {
flash.put( "changepassword_form_errors", { "Change Password" : "Incorrect credentials" } );
redirectBack();
}
sknowlton
08/04/2022, 6:04 PMauth()
as a built-in function, which it isn'tOokma-Kyi
08/04/2022, 6:05 PMproperty name="auth" inject="AuthenticationService@cbauth";
Scott Steinbeck
08/04/2022, 6:05 PMauth
not auth()
sknowlton
08/04/2022, 6:05 PMauth()
that's the problemOokma-Kyi
08/04/2022, 6:06 PMScott Steinbeck
08/04/2022, 6:06 PMauth()
is provided in views to access the auth moduleScott Steinbeck
08/04/2022, 6:07 PMOokma-Kyi
08/04/2022, 6:07 PMOokma-Kyi
08/04/2022, 6:21 PMScott Steinbeck
08/04/2022, 6:21 PMOokma-Kyi
08/04/2022, 6:22 PMprint("We authenticated successfully");
Scott Steinbeck
08/04/2022, 6:23 PMwriteoutput
or writedump
for complex dataScott Steinbeck
08/04/2022, 6:23 PMecho
as an alias to writeoutput
Ookma-Kyi
08/04/2022, 6:30 PMScott Steinbeck
08/04/2022, 6:30 PMScott Steinbeck
08/04/2022, 6:31 PMOokma-Kyi
08/04/2022, 6:31 PMScott Steinbeck
08/04/2022, 6:33 PMOokma-Kyi
08/04/2022, 6:35 PMtry{
auth.authenticate( email, rc.password );
writeOutput("Ok");
var user = getInstance( "User" ).update( { "password" : rc.newpassword } );
writeOutput("Password Changed")
auth.logout();
relocate( uri = "/" );
} catch ( InvalidCredentials e ) {
flash.put( "changepassword_form_errors", { "Change Password" : "Incorrect current password" } );
redirectBack();
}
Scott Steinbeck
08/04/2022, 6:37 PMwriteOutput("Password Changed");abort;
to see the messageScott Steinbeck
08/04/2022, 6:37 PMOokma-Kyi
08/04/2022, 6:41 PMflash.put( "changepassword_form_errors", { "Change Password" : "Incorrect current password" } );
Ookma-Kyi
08/04/2022, 6:43 PMwil-shiftinsert
08/05/2022, 9:55 AMin a handler or model, you need to inject the auth module so that you can access itScott, you can also use auth() in handlers. There’s a difference between view helpers and global application helpers This function is registered as a global application helper, which means it will be available inside views, layouts AND handlers.