-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorg.gluu.agama.registration.main.flow
59 lines (59 loc) · 2.71 KB
/
org.gluu.agama.registration.main.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// User Registration Techniques
Flow org.gluu.agama.registration.main
Basepath ""
Timeout 360 seconds
Configs conf
// Create variable for UI feedback
uiFeedback = {}
// Iterate x times max
max = Repeat 6 times max
// Retrieve user profile from UI
userInput = RRF "profile.ftlh" uiFeedback
// Assign userName and email to a variable
email = userInput.mail
userName = userInput.uid
// Matching password
When userInput.userPassword is userInput.confirmPassword
// Create an instance of User Registration Class
userRegistrationService = Call org.gluu.agama.user.UserRegistration#getInstance
// Check user already exist or not
user = Call userRegistrationService getUserEntity email
// If user not found
When user.empty is true
// Call user registration service method to register a new user
inum | E = Call userRegistrationService addNewUser userInput
// If user registration success
When inum is not null
// Show user creation log
Log "@info User % has been created" inum
// Show acknowledgement UI page for successful registration
acknowledgementInput = RRF "acknowledgement.ftlh"
// If User clicks in continue button
When acknowledgementInput.ack is not null
// Finish the flow successfully
Log "@info Finish the flow successfully"
// Assign User Id to a variable
uid = userInput.uid
// Finish the flow successfully
it_vxlwb = {success:true, data: { userId: uid}}
Finish it_vxlwb
Otherwise
// Registration failed log
Log "@info User registration failed. Error : %" E
// Error variable assignment.
uiFeedback.errorMessage = "FailedUserRegistration"
Otherwise
// User already exists
Log "@info User already exists with mail: %" email
// Error assign variable
uiFeedback.errorMessage = "UserAlreadyExists"
Otherwise
// Password and Confirm password doesn't match
Log "@trace Password and Confirm password doesn't match"
// Error variable assignment
uiFeedback.errorMessage = "PasswordDoNotMatch"
// Maximum attempt reached
Log "@info Maximum attempt reached"
// User Registration flow failed
it_ocoit = {success:false, error: "User registration flow reached max attempts try later"}
Finish it_ocoit