@umituz/react-native-auth 3.4.29 → 3.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +426 -0
- package/package.json +1 -3
- package/src/application/README.md +513 -0
- package/src/domain/ConfigAndErrors.md +545 -0
- package/src/domain/README.md +293 -0
- package/src/domain/entities/AuthUser.md +377 -0
- package/src/domain/entities/UserProfile.md +443 -0
- package/src/infrastructure/README.md +576 -0
- package/src/infrastructure/services/README.md +417 -0
- package/src/presentation/README.md +770 -0
- package/src/presentation/components/AuthBackground.tsx +21 -0
- package/src/presentation/components/AuthContainer.tsx +3 -3
- package/src/presentation/components/LoginForm.md +331 -0
- package/src/presentation/components/PasswordIndicators.md +471 -0
- package/src/presentation/components/ProfileComponents.md +432 -0
- package/src/presentation/components/README.md +117 -0
- package/src/presentation/components/SocialLoginButtons.md +303 -0
- package/src/presentation/hooks/README.md +122 -0
- package/src/presentation/hooks/useAccountManagement.md +380 -0
- package/src/presentation/hooks/useAuth.md +255 -0
- package/src/presentation/hooks/useAuthBottomSheet.md +417 -0
- package/src/presentation/hooks/useAuthRequired.md +248 -0
- package/src/presentation/hooks/useProfileUpdate.md +327 -0
- package/src/presentation/hooks/useSocialLogin.md +411 -0
- package/src/presentation/hooks/useUserProfile.md +230 -0
- package/src/presentation/screens/README.md +198 -0
- package/src/presentation/components/AuthGradientBackground.tsx +0 -33
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
# Password Indicators
|
|
2
|
+
|
|
3
|
+
Şifre validasyonu ve kullanıcı feedback'i için component'ler.
|
|
4
|
+
|
|
5
|
+
## Component'ler
|
|
6
|
+
|
|
7
|
+
- **[`PasswordStrengthIndicator`](#passwordstrengthindicator)** - Şifre güç göstergesi
|
|
8
|
+
- **[`PasswordMatchIndicator`](#passwordmatchindicator)** - Şifre eşleşme göstergesi
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## PasswordStrengthIndicator
|
|
13
|
+
|
|
14
|
+
Şifre gereksinimlerini görsel olarak gösterir. Kullanıcı şifre girdikçe hangi gereksinimleri karşıladığını gösterir.
|
|
15
|
+
|
|
16
|
+
### Kullanım
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { PasswordStrengthIndicator } from '@umituz/react-native-auth';
|
|
20
|
+
|
|
21
|
+
function RegisterForm() {
|
|
22
|
+
const [password, setPassword] = useState('');
|
|
23
|
+
const requirements = validatePasswordRequirements(password);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View>
|
|
27
|
+
<TextInput
|
|
28
|
+
value={password}
|
|
29
|
+
onChangeText={setPassword}
|
|
30
|
+
placeholder="Şifre"
|
|
31
|
+
secureTextEntry
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<PasswordStrengthIndicator requirements={requirements} />
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Props
|
|
41
|
+
|
|
42
|
+
| Prop | Tip | Required | Default | Açıklama |
|
|
43
|
+
|------|-----|----------|---------|----------|
|
|
44
|
+
| `requirements` | `PasswordRequirements` | Yes | - | Şifre gereksinimleri objesi |
|
|
45
|
+
| `showLabels` | `boolean` | No | `true` | Label'lar gösterilsin mi |
|
|
46
|
+
|
|
47
|
+
#### PasswordRequirements
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
interface PasswordRequirements {
|
|
51
|
+
hasMinLength: boolean; // Minimum uzunluk (varsayılan: 8)
|
|
52
|
+
hasUppercase: boolean; // Büyük harf içeriyor
|
|
53
|
+
hasLowercase: boolean; // Küçük harf içeriyor
|
|
54
|
+
hasNumber: boolean; // Rakam içeriyor
|
|
55
|
+
hasSpecialChar: boolean; // Özel karakter içeriyor
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Örnekler
|
|
60
|
+
|
|
61
|
+
#### Tam Kullanım (Label'larla)
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
function PasswordField() {
|
|
65
|
+
const [password, setPassword] = useState('');
|
|
66
|
+
|
|
67
|
+
const requirements: PasswordRequirements = {
|
|
68
|
+
hasMinLength: password.length >= 8,
|
|
69
|
+
hasUppercase: /[A-Z]/.test(password),
|
|
70
|
+
hasLowercase: /[a-z]/.test(password),
|
|
71
|
+
hasNumber: /[0-9]/.test(password),
|
|
72
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(password),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<View>
|
|
77
|
+
<TextInput
|
|
78
|
+
value={password}
|
|
79
|
+
onChangeText={setPassword}
|
|
80
|
+
placeholder="Şifre"
|
|
81
|
+
secureTextEntry
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<PasswordStrengthIndicator
|
|
85
|
+
requirements={requirements}
|
|
86
|
+
showLabels={true}
|
|
87
|
+
/>
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Sadece Dot'lar (Label'sız)
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
function CompactPasswordField() {
|
|
97
|
+
const [password, setPassword] = useState('');
|
|
98
|
+
|
|
99
|
+
const requirements: PasswordRequirements = {
|
|
100
|
+
hasMinLength: password.length >= 8,
|
|
101
|
+
hasUppercase: /[A-Z]/.test(password),
|
|
102
|
+
hasLowercase: /[a-z]/.test(password),
|
|
103
|
+
hasNumber: /[0-9]/.test(password),
|
|
104
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(password),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<View>
|
|
109
|
+
<TextInput
|
|
110
|
+
value={password}
|
|
111
|
+
onChangeText={setPassword}
|
|
112
|
+
placeholder="Şifre"
|
|
113
|
+
secureTextEntry
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<PasswordStrengthIndicator
|
|
117
|
+
requirements={requirements}
|
|
118
|
+
showLabels={false}
|
|
119
|
+
/>
|
|
120
|
+
</View>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Custom Validasyon ile
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
function CustomPasswordField() {
|
|
129
|
+
const [password, setPassword] = useState('');
|
|
130
|
+
|
|
131
|
+
const requirements: PasswordRequirements = {
|
|
132
|
+
hasMinLength: password.length >= 12, // Özel: 12 karakter
|
|
133
|
+
hasUppercase: /[A-Z]/.test(password),
|
|
134
|
+
hasLowercase: /[a-z]/.test(password),
|
|
135
|
+
hasNumber: /[0-9]/.test(password),
|
|
136
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(password),
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<View>
|
|
141
|
+
<TextInput
|
|
142
|
+
value={password}
|
|
143
|
+
onChangeText={setPassword}
|
|
144
|
+
placeholder="Şifre (en az 12 karakter)"
|
|
145
|
+
secureTextEntry
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<PasswordStrengthIndicator
|
|
149
|
+
requirements={requirements}
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
{password.length > 0 && password.length < 12 && (
|
|
153
|
+
<Text style={styles.warning}>
|
|
154
|
+
Şifre en az 12 karakter olmalıdır
|
|
155
|
+
</Text>
|
|
156
|
+
)}
|
|
157
|
+
</View>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Custom Validation Hook ile
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
function usePasswordValidation(minLength = 8) {
|
|
166
|
+
const [password, setPassword] = useState('');
|
|
167
|
+
|
|
168
|
+
const requirements = useMemo(() => ({
|
|
169
|
+
hasMinLength: password.length >= minLength,
|
|
170
|
+
hasUppercase: /[A-Z]/.test(password),
|
|
171
|
+
hasLowercase: /[a-z]/.test(password),
|
|
172
|
+
hasNumber: /[0-9]/.test(password),
|
|
173
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(password),
|
|
174
|
+
}), [password, minLength]);
|
|
175
|
+
|
|
176
|
+
const allRequirementsMet = useMemo(() =>
|
|
177
|
+
Object.values(requirements).every(Boolean),
|
|
178
|
+
[requirements]
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
password,
|
|
183
|
+
setPassword,
|
|
184
|
+
requirements,
|
|
185
|
+
allRequirementsMet,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function RegisterForm() {
|
|
190
|
+
const { password, setPassword, requirements, allRequirementsMet } = usePasswordValidation();
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<View>
|
|
194
|
+
<TextInput
|
|
195
|
+
value={password}
|
|
196
|
+
onChangeText={setPassword}
|
|
197
|
+
placeholder="Şifre"
|
|
198
|
+
secureTextEntry
|
|
199
|
+
/>
|
|
200
|
+
|
|
201
|
+
<PasswordStrengthIndicator requirements={requirements} />
|
|
202
|
+
|
|
203
|
+
<Button
|
|
204
|
+
onPress={handleRegister}
|
|
205
|
+
disabled={!allRequirementsMet}
|
|
206
|
+
>
|
|
207
|
+
Kayıt Ol
|
|
208
|
+
</Button>
|
|
209
|
+
</View>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Görünüm
|
|
215
|
+
|
|
216
|
+
Label'lı modda:
|
|
217
|
+
```
|
|
218
|
+
● En az 8 karakter
|
|
219
|
+
● Büyük harf
|
|
220
|
+
● Küçük harf
|
|
221
|
+
● Rakam
|
|
222
|
+
● Özel karakter
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Label'sız modda:
|
|
226
|
+
```
|
|
227
|
+
● ● ● ● ●
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Yeşil dot ✓ = Gereklilik karşılandı
|
|
231
|
+
Gri dot ○ = Gereklilik karşılanmadı
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## PasswordMatchIndicator
|
|
236
|
+
|
|
237
|
+
İki şifre alanının eşleşip eşleşmediğini gösterir.
|
|
238
|
+
|
|
239
|
+
### Kullanım
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
import { PasswordMatchIndicator } from '@umituz/react-native-auth';
|
|
243
|
+
|
|
244
|
+
function RegisterForm() {
|
|
245
|
+
const [password, setPassword] = useState('');
|
|
246
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
247
|
+
|
|
248
|
+
const passwordsMatch = password === confirmPassword && password.length > 0;
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<View>
|
|
252
|
+
<TextInput
|
|
253
|
+
value={password}
|
|
254
|
+
onChangeText={setPassword}
|
|
255
|
+
placeholder="Şifre"
|
|
256
|
+
secureTextEntry
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
<TextInput
|
|
260
|
+
value={confirmPassword}
|
|
261
|
+
onChangeText={setConfirmPassword}
|
|
262
|
+
placeholder="Şifre Tekrar"
|
|
263
|
+
secureTextEntry
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
<PasswordMatchIndicator isMatch={passwordsMatch} />
|
|
267
|
+
</View>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Props
|
|
273
|
+
|
|
274
|
+
| Prop | Tip | Required | Açıklama |
|
|
275
|
+
|------|-----|----------|----------|
|
|
276
|
+
| `isMatch` | `boolean` | Yes | Şifreler eşleşiyor mu |
|
|
277
|
+
|
|
278
|
+
### Örnekler
|
|
279
|
+
|
|
280
|
+
#### Basit Kullanım
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
function ConfirmPasswordField() {
|
|
284
|
+
const [password, setPassword] = useState('');
|
|
285
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
286
|
+
|
|
287
|
+
const passwordsMatch = password === confirmPassword && password.length > 0;
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<View>
|
|
291
|
+
<TextInput
|
|
292
|
+
value={confirmPassword}
|
|
293
|
+
onChangeText={setConfirmPassword}
|
|
294
|
+
placeholder="Şifre Tekrar"
|
|
295
|
+
secureTextEntry
|
|
296
|
+
/>
|
|
297
|
+
|
|
298
|
+
{confirmPassword.length > 0 && (
|
|
299
|
+
<PasswordMatchIndicator isMatch={passwordsMatch} />
|
|
300
|
+
)}
|
|
301
|
+
</View>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### Buton Disabled State ile
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
function RegisterForm() {
|
|
310
|
+
const [password, setPassword] = useState('');
|
|
311
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
312
|
+
|
|
313
|
+
const passwordsMatch = password === confirmPassword && password.length > 0;
|
|
314
|
+
const canSubmit = passwordsMatch && password.length >= 8;
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<View>
|
|
318
|
+
<TextInput
|
|
319
|
+
value={password}
|
|
320
|
+
onChangeText={setPassword}
|
|
321
|
+
placeholder="Şifre"
|
|
322
|
+
secureTextEntry
|
|
323
|
+
/>
|
|
324
|
+
|
|
325
|
+
<TextInput
|
|
326
|
+
value={confirmPassword}
|
|
327
|
+
onChangeText={setConfirmPassword}
|
|
328
|
+
placeholder="Şifre Tekrar"
|
|
329
|
+
secureTextEntry
|
|
330
|
+
/>
|
|
331
|
+
|
|
332
|
+
<PasswordMatchIndicator isMatch={passwordsMatch} />
|
|
333
|
+
|
|
334
|
+
<Button
|
|
335
|
+
onPress={handleRegister}
|
|
336
|
+
disabled={!canSubmit}
|
|
337
|
+
>
|
|
338
|
+
Kayıt Ol
|
|
339
|
+
</Button>
|
|
340
|
+
</View>
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### Custom Validation ile
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
function SecureRegisterForm() {
|
|
349
|
+
const [password, setPassword] = useState('');
|
|
350
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
351
|
+
|
|
352
|
+
const passwordsMatch = password === confirmPassword && password.length > 0;
|
|
353
|
+
|
|
354
|
+
// Şifre güvenliği kontrolü
|
|
355
|
+
const isPasswordSecure = useMemo(() => {
|
|
356
|
+
const hasMinLength = password.length >= 8;
|
|
357
|
+
const hasUppercase = /[A-Z]/.test(password);
|
|
358
|
+
const hasLowercase = /[a-z]/.test(password);
|
|
359
|
+
const hasNumber = /[0-9]/.test(password);
|
|
360
|
+
|
|
361
|
+
return hasMinLength && hasUppercase && hasLowercase && hasNumber;
|
|
362
|
+
}, [password]);
|
|
363
|
+
|
|
364
|
+
const canSubmit = passwordsMatch && isPasswordSecure;
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<View>
|
|
368
|
+
<TextInput
|
|
369
|
+
value={password}
|
|
370
|
+
onChangeText={setPassword}
|
|
371
|
+
placeholder="Şifre"
|
|
372
|
+
secureTextEntry
|
|
373
|
+
/>
|
|
374
|
+
|
|
375
|
+
<TextInput
|
|
376
|
+
value={confirmPassword}
|
|
377
|
+
onChangeText={setConfirmPassword}
|
|
378
|
+
placeholder="Şifre Tekrar"
|
|
379
|
+
secureTextEntry
|
|
380
|
+
/>
|
|
381
|
+
|
|
382
|
+
{confirmPassword.length > 0 && (
|
|
383
|
+
<PasswordMatchIndicator isMatch={passwordsMatch} />
|
|
384
|
+
)}
|
|
385
|
+
|
|
386
|
+
<Button
|
|
387
|
+
onPress={handleRegister}
|
|
388
|
+
disabled={!canSubmit}
|
|
389
|
+
>
|
|
390
|
+
Kayıt Ol
|
|
391
|
+
</Button>
|
|
392
|
+
</View>
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Görünüm
|
|
398
|
+
|
|
399
|
+
Eşleşiyor ✓:
|
|
400
|
+
```
|
|
401
|
+
● Şifreler eşleşiyor
|
|
402
|
+
```
|
|
403
|
+
(Yeşil renk)
|
|
404
|
+
|
|
405
|
+
Eşleşmiyor ✗:
|
|
406
|
+
```
|
|
407
|
+
● Şifreler eşleşmiyor
|
|
408
|
+
```
|
|
409
|
+
(Kırmızı renk)
|
|
410
|
+
|
|
411
|
+
## Birlikte Kullanım
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
function CompleteRegisterForm() {
|
|
415
|
+
const [password, setPassword] = useState('');
|
|
416
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
417
|
+
|
|
418
|
+
const requirements: PasswordRequirements = {
|
|
419
|
+
hasMinLength: password.length >= 8,
|
|
420
|
+
hasUppercase: /[A-Z]/.test(password),
|
|
421
|
+
hasLowercase: /[a-z]/.test(password),
|
|
422
|
+
hasNumber: /[0-9]/.test(password),
|
|
423
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(password),
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
const allRequirementsMet = Object.values(requirements).every(Boolean);
|
|
427
|
+
const passwordsMatch = password === confirmPassword && password.length > 0;
|
|
428
|
+
const canSubmit = allRequirementsMet && passwordsMatch;
|
|
429
|
+
|
|
430
|
+
return (
|
|
431
|
+
<View>
|
|
432
|
+
<TextInput
|
|
433
|
+
value={password}
|
|
434
|
+
onChangeText={setPassword}
|
|
435
|
+
placeholder="Şifre"
|
|
436
|
+
secureTextEntry
|
|
437
|
+
/>
|
|
438
|
+
|
|
439
|
+
<PasswordStrengthIndicator requirements={requirements} />
|
|
440
|
+
|
|
441
|
+
<TextInput
|
|
442
|
+
value={confirmPassword}
|
|
443
|
+
onChangeText={setConfirmPassword}
|
|
444
|
+
placeholder="Şifre Tekrar"
|
|
445
|
+
secureTextEntry
|
|
446
|
+
/>
|
|
447
|
+
|
|
448
|
+
{confirmPassword.length > 0 && (
|
|
449
|
+
<PasswordMatchIndicator isMatch={passwordsMatch} />
|
|
450
|
+
)}
|
|
451
|
+
|
|
452
|
+
<Button
|
|
453
|
+
onPress={handleRegister}
|
|
454
|
+
disabled={!canSubmit}
|
|
455
|
+
>
|
|
456
|
+
Kayıt Ol
|
|
457
|
+
</Button>
|
|
458
|
+
</View>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## İlgili Component'ler
|
|
464
|
+
|
|
465
|
+
- [`RegisterForm`](./LoginForm.md#registerform) - Kayıt formu
|
|
466
|
+
- [`useRegisterForm`](../hooks/useRegisterForm.md) - Register form hook'u
|
|
467
|
+
|
|
468
|
+
## İlgili Util'ler
|
|
469
|
+
|
|
470
|
+
- [`validatePasswordForRegister`](../../infrastructure/utils/AuthValidation.ts) - Şifre validasyonu
|
|
471
|
+
- [`DEFAULT_VAL_CONFIG`](../../infrastructure/utils/AuthValidation.ts) - Varsayılan validasyon konfigürasyonu
|