Skip to content

Commit f77eff0

Browse files
Improve authentication demo
1 parent b75331c commit f77eff0

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

demo/project.godot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config_version=5
1111
[application]
1212

1313
config/name="Godot Firebase Android"
14+
config/tags=PackedStringArray("android", "demo", "plugin")
1415
run/main_scene="res://main.tscn"
1516
config/quit_on_go_back=false
1617
config/features=PackedStringArray("4.4", "GL Compatibility")

demo/scenes/authentication.gd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ func _ready() -> void:
1414
Firebase.auth.auth_success.connect(print_output.bind("auth_success"))
1515
Firebase.auth.auth_failure.connect(print_output.bind("auth_failure"))
1616
Firebase.auth.sign_out_success.connect(print_output.bind("sign_out_success"))
17+
Firebase.auth.email_verification_sent.connect(print_output.bind("email_verification_sent"))
18+
Firebase.auth.password_reset_sent.connect(print_output.bind("password_reset_sent"))
19+
Firebase.auth.user_deleted.connect(print_output.bind("user_deleted"))
1720

1821
func print_output(arg, context: String):
1922
output_panel.text += context + ": " +str(arg) + "\n"
@@ -49,3 +52,11 @@ func _on_sign_out_pressed() -> void:
4952

5053
func _on_delete_user_pressed() -> void:
5154
Firebase.auth.delete_current_user()
55+
56+
57+
func _on_email_verification_pressed() -> void:
58+
Firebase.auth.send_email_verification()
59+
60+
61+
func _on_password_reset_pressed() -> void:
62+
Firebase.auth.send_password_reset_email(email.text)

demo/scenes/authentication.tscn

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,26 @@ theme_override_styles/pressed = SubResource("StyleBoxFlat_0xm2m")
105105
theme_override_styles/normal = SubResource("StyleBoxFlat_ig7tw")
106106
text = "Sign In With Email Password"
107107

108+
[node name="email_verification" type="Button" parent="MarginContainer/VBoxContainer"]
109+
custom_minimum_size = Vector2(120, 60)
110+
layout_mode = 2
111+
theme_override_font_sizes/font_size = 32
112+
theme_override_styles/focus = SubResource("StyleBoxFlat_7dm0k")
113+
theme_override_styles/hover = SubResource("StyleBoxFlat_ig7tw")
114+
theme_override_styles/pressed = SubResource("StyleBoxFlat_0xm2m")
115+
theme_override_styles/normal = SubResource("StyleBoxFlat_ig7tw")
116+
text = "Send Email Verification"
117+
118+
[node name="password_reset" type="Button" parent="MarginContainer/VBoxContainer"]
119+
custom_minimum_size = Vector2(120, 60)
120+
layout_mode = 2
121+
theme_override_font_sizes/font_size = 32
122+
theme_override_styles/focus = SubResource("StyleBoxFlat_7dm0k")
123+
theme_override_styles/hover = SubResource("StyleBoxFlat_ig7tw")
124+
theme_override_styles/pressed = SubResource("StyleBoxFlat_0xm2m")
125+
theme_override_styles/normal = SubResource("StyleBoxFlat_ig7tw")
126+
text = "Send Password Reset Email"
127+
108128
[node name="google_sign_in" type="Button" parent="MarginContainer/VBoxContainer"]
109129
custom_minimum_size = Vector2(120, 60)
110130
layout_mode = 2
@@ -163,6 +183,8 @@ theme_override_font_sizes/normal_font_size = 32
163183
[connection signal="pressed" from="MarginContainer/VBoxContainer/anonymous_sign_in" to="." method="_on_anonymous_sign_in_pressed"]
164184
[connection signal="pressed" from="MarginContainer/VBoxContainer/email_sign_up" to="." method="_on_email_sign_up_pressed"]
165185
[connection signal="pressed" from="MarginContainer/VBoxContainer/email_sign_in" to="." method="_on_email_sign_in_pressed"]
186+
[connection signal="pressed" from="MarginContainer/VBoxContainer/email_verification" to="." method="_on_email_verification_pressed"]
187+
[connection signal="pressed" from="MarginContainer/VBoxContainer/password_reset" to="." method="_on_password_reset_pressed"]
166188
[connection signal="pressed" from="MarginContainer/VBoxContainer/google_sign_in" to="." method="_on_google_sign_in_pressed"]
167189
[connection signal="pressed" from="MarginContainer/VBoxContainer/get_user_data" to="." method="_on_get_user_data_pressed"]
168190
[connection signal="pressed" from="MarginContainer/VBoxContainer/is_signed_in" to="." method="_on_is_signed_in_pressed"]

0 commit comments

Comments
 (0)