-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SilentWolf ! .gitignore api key (:
- Loading branch information
1 parent
53234ed
commit 99efdc9
Showing
54 changed files
with
4,420 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
.import/ | ||
[Aa]ndroid/ | ||
[Ee]xport/*/ | ||
[Ee]xport/_mac* | ||
[Ee]xport/_mac* | ||
silent_wolf_api_key.gd |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
extends TextureRect | ||
|
||
|
||
const SWLogger = preload("res://addons/silent_wolf/utils/SWLogger.gd") | ||
|
||
|
||
func _ready(): | ||
SilentWolf.Auth.connect("sw_email_verif_succeeded", self, "_on_confirmation_succeeded") | ||
SilentWolf.Auth.connect("sw_email_verif_failed", self, "_on_confirmation_failed") | ||
SilentWolf.Auth.connect("sw_resend_conf_code_succeeded", self, "_on_resend_code_succeeded") | ||
SilentWolf.Auth.connect("sw_resend_conf_code_failed", self, "_on_resend_code_failed") | ||
|
||
|
||
func _on_confirmation_succeeded(): | ||
SWLogger.info("email verification succeeded: " + str(SilentWolf.Auth.logged_in_player)) | ||
# redirect to configured scene (user is logged in after registration) | ||
var scene_name = SilentWolf.auth_config.redirect_to_scene | ||
get_tree().change_scene(scene_name) | ||
|
||
|
||
func _on_confirmation_failed(error): | ||
hide_processing_label() | ||
SWLogger.info("email verification failed: " + str(error)) | ||
$"FormContainer/ErrorMessage".text = error | ||
$"FormContainer/ErrorMessage".show() | ||
|
||
|
||
func _on_resend_code_succeeded(): | ||
SWLogger.info("Code resend succeeded for player: " + str(SilentWolf.Auth.tmp_username)) | ||
$"FormContainer/ErrorMessage".text = "Confirmation code was resent to your email address. Please check your inbox (and your spam)." | ||
$"FormContainer/ErrorMessage".show() | ||
|
||
|
||
func _on_resend_code_failed(): | ||
SWLogger.info("Code resend failed for player: " + str(SilentWolf.Auth.tmp_username)) | ||
$"FormContainer/ErrorMessage".text = "Confirmation code could not be resent" | ||
$"FormContainer/ErrorMessage".show() | ||
|
||
|
||
func show_processing_label(): | ||
$"FormContainer/ProcessingLabel".show() | ||
|
||
|
||
func hide_processing_label(): | ||
$"FormContainer/ProcessingLabel".hide() | ||
|
||
|
||
func _on_ConfirmButton_pressed(): | ||
var username = SilentWolf.Auth.tmp_username | ||
var code = $"FormContainer/CodeContainer/VerifCode".text | ||
SWLogger.debug("Email verification form submitted, code: " + str(code)) | ||
SilentWolf.Auth.verify_email(username, code) | ||
show_processing_label() | ||
|
||
|
||
func _on_ResendConfCodeButton_pressed(): | ||
var username = SilentWolf.Auth.tmp_username | ||
SWLogger.debug("Requesting confirmation code resend") | ||
SilentWolf.Auth.resend_conf_code(username) | ||
show_processing_label() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
[gd_scene load_steps=13 format=2] | ||
|
||
[ext_resource path="res://addons/silent_wolf/Auth/ConfirmEmail.gd" type="Script" id=1] | ||
[ext_resource path="res://addons/silent_wolf/common/SWButton.tscn" type="PackedScene" id=2] | ||
[ext_resource path="res://addons/silent_wolf/assets/fonts/Comfortaa-Bold.ttf" type="DynamicFontData" id=3] | ||
|
||
[sub_resource type="DynamicFontData" id=13] | ||
font_path = "res://addons/silent_wolf/assets/fonts/Comfortaa-Bold.ttf" | ||
|
||
[sub_resource type="DynamicFont" id=1] | ||
size = 64 | ||
font_data = SubResource( 13 ) | ||
|
||
[sub_resource type="DynamicFont" id=2] | ||
size = 48 | ||
font_data = SubResource( 13 ) | ||
|
||
[sub_resource type="DynamicFont" id=3] | ||
size = 32 | ||
font_data = ExtResource( 3 ) | ||
|
||
[sub_resource type="DynamicFont" id=4] | ||
size = 32 | ||
font_data = SubResource( 13 ) | ||
|
||
[sub_resource type="StyleBoxFlat" id=5] | ||
content_margin_left = 23.0 | ||
content_margin_right = 23.0 | ||
content_margin_top = 23.0 | ||
content_margin_bottom = 23.0 | ||
bg_color = Color( 0.831373, 0.415686, 0.415686, 1 ) | ||
corner_radius_top_left = 20 | ||
corner_radius_top_right = 20 | ||
corner_radius_bottom_right = 20 | ||
corner_radius_bottom_left = 20 | ||
|
||
[sub_resource type="StyleBoxFlat" id=6] | ||
content_margin_left = 23.0 | ||
content_margin_right = 23.0 | ||
content_margin_top = 23.0 | ||
content_margin_bottom = 23.0 | ||
bg_color = Color( 0.831373, 0.415686, 0.415686, 1 ) | ||
corner_radius_top_left = 20 | ||
corner_radius_top_right = 20 | ||
corner_radius_bottom_right = 20 | ||
corner_radius_bottom_left = 20 | ||
|
||
[sub_resource type="StyleBoxFlat" id=7] | ||
content_margin_left = 23.0 | ||
content_margin_right = 23.0 | ||
content_margin_top = 23.0 | ||
content_margin_bottom = 23.0 | ||
bg_color = Color( 0.482353, 0.458824, 0.458824, 1 ) | ||
corner_radius_top_left = 20 | ||
corner_radius_top_right = 20 | ||
corner_radius_bottom_right = 20 | ||
corner_radius_bottom_left = 20 | ||
|
||
[sub_resource type="DynamicFont" id=8] | ||
size = 64 | ||
font_data = ExtResource( 3 ) | ||
|
||
[node name="ConfirmEmail" type="TextureRect"] | ||
margin_right = 40.0 | ||
margin_bottom = 40.0 | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="FormContainer" type="VBoxContainer" parent="."] | ||
margin_left = 565.0 | ||
margin_top = 197.0 | ||
margin_right = 1500.0 | ||
margin_bottom = 798.0 | ||
custom_constants/separation = 100 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Label" type="Label" parent="FormContainer"] | ||
margin_right = 935.0 | ||
margin_bottom = 72.0 | ||
custom_fonts/font = SubResource( 1 ) | ||
text = "Confirm your email address" | ||
align = 1 | ||
|
||
[node name="CodeContainer" type="HBoxContainer" parent="FormContainer"] | ||
margin_top = 172.0 | ||
margin_right = 935.0 | ||
margin_bottom = 247.0 | ||
custom_constants/separation = 20 | ||
|
||
[node name="Label" type="Label" parent="FormContainer/CodeContainer"] | ||
margin_top = 10.0 | ||
margin_right = 133.0 | ||
margin_bottom = 65.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "Code" | ||
|
||
[node name="VerifCode" type="LineEdit" parent="FormContainer/CodeContainer"] | ||
margin_left = 153.0 | ||
margin_right = 483.0 | ||
margin_bottom = 75.0 | ||
rect_min_size = Vector2( 330, 75 ) | ||
custom_fonts/font = SubResource( 3 ) | ||
max_length = 30 | ||
|
||
[node name="ErrorMessage" type="Label" parent="FormContainer"] | ||
visible = false | ||
margin_top = 522.0 | ||
margin_right = 648.0 | ||
margin_bottom = 559.0 | ||
custom_fonts/font = SubResource( 4 ) | ||
custom_colors/font_color = Color( 0.866667, 0.101961, 0.101961, 1 ) | ||
autowrap = true | ||
|
||
[node name="ConfirmButton" parent="FormContainer" instance=ExtResource( 2 )] | ||
margin_top = 347.0 | ||
margin_right = 935.0 | ||
margin_bottom = 465.0 | ||
text = "Submit" | ||
|
||
[node name="ResendConfCodeButton" parent="FormContainer" instance=ExtResource( 2 )] | ||
margin_top = 565.0 | ||
margin_right = 935.0 | ||
margin_bottom = 683.0 | ||
custom_styles/hover = SubResource( 5 ) | ||
custom_styles/pressed = SubResource( 6 ) | ||
custom_styles/normal = SubResource( 7 ) | ||
custom_fonts/font = SubResource( 8 ) | ||
text = "Resend code" | ||
|
||
[node name="ProcessingLabel" type="Label" parent="FormContainer"] | ||
visible = false | ||
margin_top = 740.0 | ||
margin_right = 648.0 | ||
margin_bottom = 812.0 | ||
custom_fonts/font = SubResource( 1 ) | ||
text = "Processing..." | ||
align = 1 | ||
[connection signal="pressed" from="FormContainer/ConfirmButton" to="." method="_on_ConfirmButton_pressed"] | ||
[connection signal="pressed" from="FormContainer/ResendConfCodeButton" to="." method="_on_ResendConfCodeButton_pressed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
extends TextureRect | ||
|
||
const SWLogger = preload("res://addons/silent_wolf/utils/SWLogger.gd") | ||
|
||
func _ready(): | ||
#var auth_node = get_tree().get_root().get_node("res://addons/silent_wolf/Auth/Auth") | ||
SilentWolf.Auth.connect("sw_login_succeeded", self, "_on_login_succeeded") | ||
SilentWolf.Auth.connect("sw_login_failed", self, "_on_login_failed") | ||
|
||
func _on_LoginButton_pressed(): | ||
var username = $"FormContainer/UsernameContainer/Username".text | ||
var password = $"FormContainer/PasswordContainer/Password".text | ||
var remember_me = $"FormContainer/RememberMeCheckBox".is_pressed() | ||
SWLogger.debug("Login form submitted, remember_me: " + str(remember_me)) | ||
SilentWolf.Auth.login_player(username, password, remember_me) | ||
show_processing_label() | ||
|
||
func _on_login_succeeded(): | ||
var scene_name = SilentWolf.auth_config.redirect_to_scene | ||
SWLogger.info("logged in as: " + str(SilentWolf.Auth.logged_in_player)) | ||
get_tree().change_scene(scene_name) | ||
|
||
func _on_login_failed(error): | ||
hide_processing_label() | ||
SWLogger.info("log in failed: " + str(error)) | ||
$"FormContainer/ErrorMessage".text = error | ||
$"FormContainer/ErrorMessage".show() | ||
|
||
func _on_BackButton_pressed(): | ||
get_tree().change_scene(SilentWolf.auth_config.redirect_to_scene) | ||
|
||
func show_processing_label(): | ||
$"FormContainer/ProcessingLabel".show() | ||
$"FormContainer/ProcessingLabel".show() | ||
|
||
func hide_processing_label(): | ||
$"FormContainer/ProcessingLabel".hide() | ||
|
||
|
||
func _on_LinkButton_pressed(): | ||
get_tree().change_scene(SilentWolf.auth_config.reset_password_scene) |
Oops, something went wrong.