text stringlengths 0 234 |
|---|
User : User_Ref; |
Email : Email_Ref; |
Ctx : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; |
Flash : constant ASF.Contexts.Faces.Flash_Context_Access := Ctx.Get_Flash; |
begin |
Email.Set_Email (Data.Email); |
User.Set_First_Name (Data.First_Name); |
User.Set_Last_Name (Data.Last_Name); |
User.Set_Password (Data.Password); |
Data.Manager.Create_User (User => User, |
Email => Email); |
Outcome := To_Unbounded_String ("success"); |
-- Add a message to the flash context so that it will be displayed on the next page. |
Flash.Set_Keep_Messages (True); |
Messages.Factory.Add_Message (Ctx.all, "users.message_signup_sent", Messages.INFO); |
exception |
when Services.User_Exist => |
Outcome := To_Unbounded_String ("failure"); |
Messages.Factory.Add_Message (Ctx.all, "users.signup_error_message"); |
end Register_User; |
-- ------------------------------ |
-- Action to verify the user after the registration |
-- ------------------------------ |
procedure Verify_User (Data : in out Authenticate_Bean; |
Outcome : in out Unbounded_String) is |
Principal : AWA.Users.Principals.Principal_Access; |
Ctx : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; |
Flash : constant ASF.Contexts.Faces.Flash_Context_Access := Ctx.Get_Flash; |
begin |
Data.Manager.Verify_User (Key => To_String (Data.Access_Key), |
IpAddr => "", |
Principal => Principal); |
Data.Set_Session_Principal (Principal); |
Outcome := To_Unbounded_String ("success"); |
-- Add a message to the flash context so that it will be displayed on the next page. |
Flash.Set_Keep_Messages (True); |
Messages.Factory.Add_Message (Ctx.all, "users.message_registration_done", Messages.INFO); |
exception |
when Services.Not_Found => |
Outcome := To_Unbounded_String ("failure"); |
Messages.Factory.Add_Message (Ctx.all, "users.error_verify_register_key"); |
end Verify_User; |
-- ------------------------------ |
-- Action to trigger the lost password email process. |
-- ------------------------------ |
procedure Lost_Password (Data : in out Authenticate_Bean; |
Outcome : in out Unbounded_String) is |
Ctx : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; |
Flash : constant ASF.Contexts.Faces.Flash_Context_Access := Ctx.Get_Flash; |
begin |
Data.Manager.Lost_Password (Email => To_String (Data.Email)); |
Outcome := To_Unbounded_String ("success"); |
-- Add a message to the flash context so that it will be displayed on the next page. |
Flash.Set_Keep_Messages (True); |
Messages.Factory.Add_Message (Ctx.all, "users.message_lost_password_sent", Messages.INFO); |
exception |
when Services.Not_Found => |
Messages.Factory.Add_Message (Ctx.all, "users.error_email_not_found"); |
end Lost_Password; |
-- ------------------------------ |
-- Action to validate the reset password key and set a new password. |
-- ------------------------------ |
procedure Reset_Password (Data : in out Authenticate_Bean; |
Outcome : in out Unbounded_String) is |
Ctx : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; |
Flash : constant ASF.Contexts.Faces.Flash_Context_Access := Ctx.Get_Flash; |
Principal : AWA.Users.Principals.Principal_Access; |
begin |
Data.Manager.Reset_Password (Key => To_String (Data.Access_Key), |
Password => To_String (Data.Password), |
IpAddr => "", |
Principal => Principal); |
Data.Set_Session_Principal (Principal); |
Outcome := To_Unbounded_String ("success"); |
-- Add a message to the flash context so that it will be displayed on the next page. |
Flash.Set_Keep_Messages (True); |
Messages.Factory.Add_Message (Ctx.all, "users.message_reset_password_done", Messages.INFO); |
exception |
when Services.Not_Found => |
Messages.Factory.Add_Message (Ctx.all, "users.error_reset_password"); |
end Reset_Password; |
procedure Set_Session_Principal (Data : in Authenticate_Bean; |
Principal : in AWA.Users.Principals.Principal_Access) is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.