Skip to content

Commit 63eba49

Browse files
committed
feat: publish agama-registration project
1 parent bba11fd commit 63eba49

17 files changed

+1965
-2
lines changed

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# agama-registration
2-
Agama Project to provide a sample workflow for registration
1+
### agama-registration
2+
Designing an Agama Flow for seamless user registration with validation and authentication.

code/README.md

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

0 commit comments

Comments
 (0)